package com.yqh.dao;

import com.yqh.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;


/**
 * user 模块数据相关
 *
 * @author 阳秋豪
 * @createTime 2024/3/22
 */
@Mapper
public interface UserDao {

    // 根据用户名与密码查询用户
    @Select("select * from user where user_name=#{userName} and password=#{password}")
    User findByUserNameAndPassword(String userName, String password);

    @Select("select * from user where user_name=#{userName}")
    User findByUserName(String userName);

    @Insert("insert into user(user_name, password) value (#{userName},#{password})")
    void addUser(String userName, String password);

    // todo 未使用
    @Select("select * from user where user_id=#{UserId}")
    User findUserById(Integer UserId);
}
